package cn.tedu.order;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;

@SpringBootTest
public class RestTemplateTests {

    @Autowired
    private RestTemplate restTemplate;

    @Test
    public void getUserInfo() {
        //用户服务的获取用户信息接口地址
        String url = "http://localhost:7070/user/info/1";
        ResponseEntity<String> entity =
                restTemplate.getForEntity(url, String.class);
        String body = entity.getBody();
        HttpStatus statusCode = entity.getStatusCode();
        System.out.println(statusCode);
        System.out.println(body);

    }
}
